<?php 
// wymagane w layout
//echo $this->Section->main();
?>

<div class="content-homenpage">
	<?php echo $this->element('carousel',array('plugin' => 'store',
		'items'=>$this->Store->products(4,array('limit'=>12))
		,'group_id'=>4
		,'params'=>array('width'=>190,'height'=>190,'padding'=>10,'margin'=>10,'border'=>1)
		));?>	
	<div class="clr"></div>	
</div>	
		
<div class="clr"></div>
	<div class="content-homenpage">
		<div id="left-column">
			<?php echo $this->element('left_column')?>		
		</div>
		
		<div class="right-store-column search-bg">
			<?php echo $this->element('search_more',array('plugin'=>'store'))?>
		</div>
		
		<div class="right-store-column">	
		
			<div class="post .right-content">
				<table class="blog">
					<tr>
						<td>
						<table width="100%" cellpadding="10" cellspacing="0" class="post">
							<tr>
								<td><?php echo $this->Html->link('<h2>'.$post['Post']['name'].'</h2>', array('action' => 'view', $post['Post']['id']),array('escape'=>false)); ?>
									<span class="modified-date"><?php echo $post['Post']['modified']; ?></span>&nbsp;
								</td>
							</tr>
							<tr>
								<td class="content">
								<?php echo $post['Post']['content'];
								?>&nbsp;</td>
							</tr>
							<tr>
								<td>
									<table class="corners" bgcolor="#bbbbbb" cellpadding="4" width="100%" cellspacing="4">
										<tr>
											<td valign="middle" width="12%">
												<?php echo __('Comments:',true)?>
											</td>
											<td valign="middle" align="center" width="3%">
												<?php echo count($post['Comment'])?>
												
											</td>
											<td valign="middle" width="45%">&nbsp;</td>
											<td align="right" valign="middle" width="40%">
												<?php echo $this->Html->link(__('+ add comment',true), array('controller'=>'comments','action' => 'add', $post['Post']['id']),array('class'=>'button corners')); ?>
											</td>								
										</tr>
									</table>
								</td>
							</tr>
						</table>
						</td>
					</tr>
				</table>
			</div>
			
			
			<div class="related">
				<h3><?php __('Related Comments');?></h3>
				<?php if (!empty($post['Comment'])):?>
				<table cellpadding = "0" cellspacing = "0" width="100%">
				<?php
					foreach ($post['Comment'] as $comment):
					?>
					<?php if($comment['status']){?>
					<tr>
						<td>
						<table width="100%" cellpadding="10" cellspacing="0" class="post">
							<tr>
								<td class="content">
								<?php echo $comment['content']?>&nbsp;</td>
							</tr>
							<tr>
								<td>
									<table class="corners" bgcolor="#bbbbbb" cellpadding="4" width="100%" cellspacing="4">
										<tr>
											<td valign="middle" width="15%">
												<?php echo __('First Name:',true)?>
											</td>
											<td valign="middle" align="left" width="30%">
												<?php echo $comment['name']?>									
											</td>
											<td valign="middle" width="15%" align="right">
												<?php echo __('Added:',true)?>
											</td>
											<td valign="middle" width="40%" align="left"><?php echo $comment['added']?>&nbsp;</td>
						
										</tr>
									</table>
								</td>
							</tr>
						</table>
						</td>
					</tr>
					<?php }?>
				<?php endforeach; ?>
				</table>
			<?php endif; ?>
			
			</div>
			
			
			<?php if($session->check('Auth.User.id')){?>
			<?php echo $this->element('toolbar_actions_main',array('plugin'=>'blog','toolbar'=>'posts'))?>
			<?php }?>
		
		
		</div>
	</div>
</div>